<template>
  <div>
    <el-dialog :visible.sync="detailStudentDialogVisible" :show-close="false">
      <template slot="title">
        <div>
          <el-row>
            <el-col :span="20" style="text-align: left">
              <span style="color: #000; font-size: 40px; font-weight: 500;">
                详细学生信息
              </span>
            </el-col>
            <el-col :span="4" style="text-align: right">
              <el-button
                icon="el-icon-close"
                type="danger"
                circle
                @click="detailStudentDialogVisible=false"
              />
            </el-col>
          </el-row>
        </div>
      </template>
      <el-dialog :visible.sync="dialogData.changeStudentBaseInfoFormVisible" append-to-body width="35%" :show-close="false">
        <template slot="title">
          <div>
            <el-row>
              <el-col :span="20" style="text-align: left">
                <span style="color: #000; font-size: 40px; font-weight: 500;">
                  更改学生信息
                </span>
              </el-col>
              <el-col :span="4" style="text-align: right">
                <el-button
                  icon="el-icon-close"
                  type="danger"
                  circle
                  @click="dialogData.changeStudentBaseInfoFormVisible=false"
                />
              </el-col>
            </el-row>
          </div>
        </template>
        <el-form :model="dialogData.changeStudentBaseInfoForm">
          <el-form-item label="姓名" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiName" autocomplete="off" :disabled="true" />
          </el-form-item>
          <el-form-item label="学号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiNumber" autocomplete="off" :disabled="true" />
          </el-form-item>
          <el-form-item v-show="false" label="性别" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiSex" autocomplete="off" :disabled="true" />
          </el-form-item>
          <el-form-item label="学院" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiAcademy" autocomplete="off" />
          </el-form-item>
          <el-form-item label="系" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiDepartment" autocomplete="off" />
          </el-form-item>
          <el-form-item label="专业" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiMajor" autocomplete="off" />
          </el-form-item>
          <el-form-item label="出生日期" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-date-picker
              v-model="dialogData.changeStudentBaseInfoForm.sbiBirthdate"
              type="date"
              placeholder="选择日期"
              format="yyyy 年 MM 月 dd 日"
              value-format="yyyy-MM-ddT00:00:00.000+0000"
            />
          </el-form-item>
          <el-form-item label="民族" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiNation" autocomplete="off" />
          </el-form-item>
          <el-form-item label="前置学历" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiFormerEducation" autocomplete="off" />
          </el-form-item>
          <el-form-item label="入学方式" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiEntranceWay" autocomplete="off" />
          </el-form-item>
          <el-form-item label="入学时间（年）" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiEntranceYear" autocomplete="off" />
          </el-form-item>
          <el-form-item label="入学时间（月）" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiEntranceMonth" autocomplete="off" />
          </el-form-item>
          <el-form-item label="预计毕业时间（年）" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiPredictGraduateYear" autocomplete="off" />
          </el-form-item>
          <el-form-item label="预计毕业时间（月）" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiPredictGraduateMonth" autocomplete="off" />
          </el-form-item>
          <el-form-item label="学制" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiEducationSystem" autocomplete="off" />
          </el-form-item>
          <el-form-item label="学籍类型" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiStatusType" autocomplete="off" />
          </el-form-item>
          <el-form-item label="身份证件类型" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiIDType" autocomplete="off" />
          </el-form-item>
          <el-form-item label="身份证件号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiIDNumber" autocomplete="off" />
          </el-form-item>
          <el-form-item label="生源地国家" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input
              v-model="dialogData.changeStudentBaseInfoForm.sbiSourceOfSchoolEnrollmentCountry"
              autocomplete="off"
            />
          </el-form-item>
          <el-form-item label="生源地省" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input
              v-model="dialogData.changeStudentBaseInfoForm.sbiSourceOfSchoolEnrollmentProvince"
              autocomplete="off"
            />
          </el-form-item>
          <el-form-item label="生源地市" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input
              v-model="dialogData.changeStudentBaseInfoForm.sbiSourceOfSchoolEnrollmentCity"
              autocomplete="off"
            />
          </el-form-item>
          <el-form-item label="政治面貌" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiPolicyOutlook" autocomplete="off" />
          </el-form-item>
          <el-form-item label="户口所在地" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiRegisteredResidencePlace" autocomplete="off" />
          </el-form-item>
          <el-form-item label="入学前户口性质" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input
              v-model="dialogData.changeStudentBaseInfoForm.sbiFormerRegisteredResidenceProperty"
              autocomplete="off"
            />
          </el-form-item>
          <el-form-item label="手机号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiCellNumber" autocomplete="off" />
          </el-form-item>
          <el-form-item label="电子信箱" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiEmail" autocomplete="off" />
          </el-form-item>
          <el-form-item label="QQ号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiQq" autocomplete="off" />
          </el-form-item>
          <el-form-item label="微信号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiWechat" autocomplete="off" />
          </el-form-item>
          <el-form-item label="校外（家庭）居住国家" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiLivingCountry" autocomplete="off" />
          </el-form-item>
          <el-form-item label="校外（家庭）居住省" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiLivingProvince" autocomplete="off" />
          </el-form-item>
          <el-form-item label="校外（家庭）居住市" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiLivingCity" autocomplete="off" />
          </el-form-item>
          <el-form-item label="校外（家庭）居住区" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiLivingDistrict" autocomplete="off" />
          </el-form-item>
          <el-form-item label="校外（家庭）居住详细地址" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiLivingDetailedAddress" autocomplete="off" />
          </el-form-item>
          <el-form-item label="家属姓名" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiRelativeName" autocomplete="off" />
          </el-form-item>
          <el-form-item label="家属联系方式" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiRelativeContract" autocomplete="off" />
          </el-form-item>
          <el-form-item label="班级" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiClass" autocomplete="off" />
          </el-form-item>
          <el-form-item label="团支部" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiYouthLeagueBranch" autocomplete="off" />
          </el-form-item>
          <el-form-item label="党支部" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiPartyBranch" autocomplete="off" />
          </el-form-item>
          <el-form-item label="导师" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiTeacher" autocomplete="off" />
          </el-form-item>
          <el-form-item label="导师工号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiTeacherNumber" autocomplete="off" />
          </el-form-item>
          <el-form-item label="班主任" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiClassTeacher" autocomplete="off" />
          </el-form-item>
          <el-form-item label="班主任工号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiClassTeacherNumber" autocomplete="off" />
          </el-form-item>
          <el-form-item label="辅导员" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiInstructor" autocomplete="off" />
          </el-form-item>
          <el-form-item label="辅导员工号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiInstructorNumber" autocomplete="off" />
          </el-form-item>
          <el-form-item label="组织员" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiOrganizer" autocomplete="off" />
          </el-form-item>
          <el-form-item label="组织员工号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiOrganizerNumber" autocomplete="off" />
          </el-form-item>
          <el-form-item label="教务员" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiDean" autocomplete="off" />
          </el-form-item>
          <el-form-item label="教务员工号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiDeanNumber" autocomplete="off" />
          </el-form-item>
          <el-form-item label="住校" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiLivingAtSchool" autocomplete="off" />
          </el-form-item>
          <el-form-item label="宿舍校区" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiDormitoryCampus" autocomplete="off" />
          </el-form-item>
          <el-form-item label="宿舍楼栋" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiDormitoryBuilding" autocomplete="off" />
          </el-form-item>
          <el-form-item label="宿舍房间号" :label-width="dialogData.changeStudentBaseInfoForm.formLabelWidth">
            <el-input v-model="dialogData.changeStudentBaseInfoForm.sbiDormitoryRoom" autocomplete="off" />
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer" style="width:auto; text-align: center;">
          <el-button type="primary" @click="changeStudentBaseInfoSubmit">修改信息</el-button>
          <el-button @click="dialogData.changeStudentBaseInfoFormVisible=false">取 消</el-button>
        </div>
      </el-dialog>
      <div class="app-container" style="margin: 30px">
        <el-table
          v-loading="dialogData.loading"
          class="prize-info"
          :data="dialogData.tableData"
          style="width: 100%; border-radius: 20px"
        >
          <el-table-column
            prop="type"
            width="300"
          />
          <el-table-column
            prop="info"
          />
        </el-table>
      </div>
      <div style="margin:0 auto; width:400px;text-align:center;">
        <el-button type="primary" @click="returnReview">返回全体学生信息</el-button>
        <el-button type="primary" @click="dialogData.changeStudentBaseInfoFormVisible=true">修改个人信息</el-button>
      </div>
    </el-dialog>
    <div class="app-container">
      <div class="filter-container">
        <el-input v-model="queryParams.sbi_number" class="filter-item search-item" placeholder="按照学号查找" />
        <el-input v-model="queryParams.sbi_name" class="filter-item search-item" placeholder="按照姓名查找" />
        <el-input v-model="queryParams.sbi_academy" class="filter-item search-item" placeholder="按照学院查找" />
        <el-input v-model="queryParams.sbi_department" class="filter-item search-item" placeholder="按照系查找" />
        <el-input v-model="queryParams.sbi_major" class="filter-item search-item" placeholder="按照专业查找" />
        <el-input v-model="queryParams.sbi_class" class="filter-item search-item" placeholder="按照班级查找" />
        <el-input v-model="queryParams.sbi_youth_league_branch" class="filter-item search-item" placeholder="按照团支部查找" />
        <el-input v-model="queryParams.sbi_party_branch" class="filter-item search-item" placeholder="按照党支部查找" />
        <el-input v-model="queryParams.sbi_teacher" class="filter-item search-item" placeholder="按照导师查找" />
        <el-input v-model="queryParams.sbi_class_teacher" class="filter-item search-item" placeholder="按照班主任查找" />
        <el-input v-model="queryParams.sbi_instructor" class="filter-item search-item" placeholder="按照辅导员查找" />
        <el-input v-model="queryParams.sbi_organizer" class="filter-item search-item" placeholder="按照组织员查找" />
        <el-input v-model="queryParams.sbi_dean" class="filter-item search-item" placeholder="按照教务员查找" />
        <el-input v-model="queryParams.sbi_group" class="filter-item search-item" placeholder="按照组别查找" />
        <el-button class="filter-item" type="primary" @click="search">
          {{ $t('table.search') }}
        </el-button>
        <el-button class="filter-item" type="success" @click="reset">
          {{ $t('table.reset') }}
        </el-button>
      </div>
      <el-table
        ref="table"
        :key="tableKey"
        v-loading="loading"
        :data="list"
        border
        fit
        style="width: 100%;"
      >
        <el-table-column
          align="center"
          type="index"
          label="序号"
          width="60"
          height="45"
          style="padding-bottom: 20px;"
        />

        //学号 sbiNumber
        <el-table-column
          prop="sbiNumber"
          label="学号"
          align="center"
          sortable
          width="130"
        />

        //姓名 sbiName
        <el-table-column
          prop="sbiName"
          align="center"
          label="姓名"
          width="130"
        />

        //性别 sbiSex
        <el-table-column
          prop="sbiSex"
          align="center"
          label="性别"
          width="80"
        />

        //学院 sbiAcademy
        <el-table-column
          prop="sbiAcademy"
          align="center"
          label="学院"
          width="220"
        />

        //系 sbiDepartment
        <el-table-column
          prop="sbiDepartment"
          align="center"
          label="系"
          width="200"
        />

        //专业 sbiMajor
        <el-table-column
          prop="sbiMajor"
          align="center"
          label="专业"
          width="220"
        />

        //班级 sbiClass
        <el-table-column
          prop="sbiClass"
          align="center"
          label="班级"
          width="150"
        />

        //团支部 sbiYouthLeagueBranch
        <el-table-column
          prop="sbiYouthLeagueBranch"
          align="center"
          label="团支部"
          width="200"
        />

        //党支部 sbiPartyBranch
        <el-table-column
          prop="sbiPartyBranch"
          align="center"
          label="党支部"
          width="150"
        />

        //培养层次 sbiTrainingLevel
        <el-table-column
          prop="sbiTrainingLevel"
          align="center"
          label="培养层次"
          width="220"
        />

        //组别 sbiGroup
        <el-table-column
          prop="sbiGroup"
          align="center"
          label="组别"
          width="150"
        />

        //导师 sbiTeacher
        <el-table-column
          prop="sbiTeacher"
          align="center"
          label="导师"
          width="220"
        />

        //班主任 sbiClassTeacher
        <el-table-column
          prop="sbiClassTeacher"
          align="center"
          label="班主任"
          width="220"
        />

        //辅导员 sbiInstructor
        <el-table-column
          prop="sbiInstructor"
          align="center"
          label="辅导员"
          width="220"
        />

        //组织员 sbiOrganizer
        <el-table-column
          prop="sbiOrganizer"
          align="center"
          label="组织员"
          width="220"
        />

        //教务员 sbiDean
        <el-table-column
          prop="sbiDean"
          align="center"
          label="教务员"
          width="220"
        />

        <el-table-column
          align="center"
          label="操作"
          width="130"
          fixed="right"
        >
          <template slot-scope="scope">
            <el-button type="primary" @click="handleClick(scope.row)">
              查看
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="pagination.num"
        :limit.sync="pagination.size"
        @pagination="search"
      />
    </div>
  </div>
</template>

<script>
import Pagination from '@/components/Pagination'
import axios from 'axios'
import { getToken } from '@/utils/auth'

export default {
  components: { Pagination },
  data() {
    return {
      detailStudentDialogVisible: false,
      dialogData: {
        UserUrl: 'https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png',
        sbiAcademy: 'XXX',
        sbiDepartment: 'XXX',
        sbiMajor: 'XXX',
        sbiName: 'XXX',
        sbiNumber: 'XXXXXX',
        sbiSex: 'XX',
        loading: true,
        changeStudentBaseInfoFormVisible: false,
        changeStudentBaseInfoForm: {
          formLabelWidth: '200px',
          sbiIndex: '',
          sbiNumber: '',
          sbiName: '',
          sbiSex: '',
          sbiBirthdate: '',
          sbiNation: '',
          sbiAcademy: '',
          sbiDepartment: '',
          sbiMajor: '',
          sbiFormerEducation: '',
          sbiEntranceWay: '',
          sbiEntranceYear: '',
          sbiEntranceMonth: '',
          sbiEducationSystem: '',
          sbiPredictGraduateYear: '',
          sbiPredictGraduateMonth: '',
          sbiTrainingLevel: '',
          sbiStatusType: '',
          sbiIDType: '',
          sbiIDNumber: '',
          sbiSourceOfSchoolEnrollmentCountry: '',
          sbiSourceOfSchoolEnrollmentProvince: '',
          sbiSourceOfSchoolEnrollmentCity: '',
          sbiPolicyOutlook: '',
          sbiRegisteredResidencePlace: '',
          sbiFormerRegisteredResidenceProperty: '',
          sbiCellNumber: '',
          sbiEmail: '',
          sbiQq: '',
          sbiWechat: '',
          sbiLivingCountry: '',
          sbiLivingProvince: '',
          sbiLivingCity: '',
          sbiLivingDistrict: '',
          sbiLivingDetailedAddress: '',
          sbiRelativeName: '',
          sbiRelativeContract: '',
          sbiClass: '',
          sbiYouthLeagueBranch: '',
          sbiPartyBranch: '',
          sbiTeacher: '',
          sbiTeacherNumber: '',
          sbiClassTeacher: '',
          sbiClassTeacherNumber: '',
          sbiInstructor: '',
          sbiInstructorNumber: '',
          sbiOrganizer: '',
          sbiOrganizerNumber: '',
          sbiDean: '',
          sbiDeanNumber: '',
          sbiLivingAtSchool: '',
          sbiDormitoryCampus: '',
          sbiDormitoryBuilding: '',
          sbiDormitoryRoom: ''
        },
        tableData: []
      },
      selectSbiNumber: '',
      timeout: null,
      loading: false,
      list: [],
      queryParams: {},
      total: 1,
      pagination: {
        size: 10,
        num: 1
      },
      tableKey: 0
    }
  },
  computed: {
    currentUser() {
      return this.$store.state.account.user
    }
  },
  mounted() {
    this.reset()
    if (this.$route.query.sbiNumber) {
      this.selectSbiNumber = this.$route.query.sbiNumber
      this.fetch()
      this.detailStudentDialogVisible = true
    }
  },
  methods: {
    fetchTable(params = {}) {
      params.pageNum = this.pagination.num
      params.showPerPage = this.pagination.size
      // console.log(params)
      this.loading = true
      const queryUri = 'achievement/award/jointQueryStuInfo'
      // 学号 sbiNumber
      // 姓名 sbiName
      // 性别 sbiSex
      // 学院 sbiAcademy
      // 系 sbiDepartment
      // 专业 sbiMajor
      // 培养层次 sbiTrainingLevel
      this.$get(queryUri, {
        ...params
      }).then((r) => {
        const data = r.data.data
        this.total = data.countAll
        this.list = []
        // alert(data)
        // console.log(data)
        if (data.countAll > 0) {
          this.$message({
            message: '查询成功',
            type: 'warning'
          })
          for (let i = 0; i < data.studentBasicInfo.length; i++) {
            this.list.push(
              {
                sbiNumber: data.studentBasicInfo[i].sbiNumber,
                sbiName: data.studentBasicInfo[i].sbiName,
                sbiSex: data.studentBasicInfo[i].sbiSex,
                sbiAcademy: data.studentBasicInfo[i].sbiAcademy,
                sbiDepartment: data.studentBasicInfo[i].sbiDepartment,
                sbiMajor: data.studentBasicInfo[i].sbiMajor,
                sbiClass: data.studentBasicInfo[i].sbiClass,
                sbiYouthLeagueBranch: data.studentBasicInfo[i].sbiYouthLeagueBranch,
                sbiPartyBranch: data.studentBasicInfo[i].sbiPartyBranch,
                sbiTrainingLevel: data.studentBasicInfo[i].sbiTrainingLevel,
                sbiGroup: data.studentBasicInfo[i].sbiGroup,
                sbiTeacher: data.studentBasicInfo[i].sbiTeacher + '(' + data.studentBasicInfo[i].sbiTeacherNumber + ')',
                sbiClassTeacher: data.studentBasicInfo[i].sbiClassTeacher + '(' + data.studentBasicInfo[i].sbiClassTeacherNumber + ')',
                sbiInstructor: data.studentBasicInfo[i].sbiInstructor + '(' + data.studentBasicInfo[i].sbiInstructorNumber + ')',
                sbiOrganizer: data.studentBasicInfo[i].sbiOrganizer + '(' + data.studentBasicInfo[i].sbiOrganizerNumber + ')',
                sbiDean: data.studentBasicInfo[i].sbiDean + '(' + data.studentBasicInfo[i].sbiDeanNumber + ')'
              }
            )
          }
        } else {
          this.$message({
            message: '查询失败，请重置。',
            type: 'warning'
          })
        }
        this.loading = false
      })
    },
    search() {
      this.$refs.table.clearSort()
      this.$refs.table.clearFilter()

      this.fetchTable({
        sbiNumber: this.queryParams.sbi_number,
        sbiName: this.queryParams.sbi_name,
        sbiAcademy: this.queryParams.sbi_academy,
        sbiDepartment: this.queryParams.sbi_department,
        sbiMajor: this.queryParams.sbi_major,
        sbiClass: this.queryParams.sbi_class,
        sbiYouthLeagueBranch: this.queryParams.sbi_youth_league_branch,
        sbiPartyBranch: this.queryParams.sbi_party_branch,
        sbiTeacher: this.queryParams.sbi_teacher,
        sbiClassTeacher: this.queryParams.sbi_class_teacher,
        sbiInstructor: this.queryParams.sbi_instructor,
        sbiOrganizer: this.queryParams.sbi_organizer,
        sbiDean: this.queryParams.sbi_dean,
        sbiGroup: this.queryParams.sbi_group
      })
    },
    reset() {
      this.queryParams = {
        sbi_number: '',
        sbi_name: '',
        sbi_academy: '',
        sbi_department: '',
        sbi_major: '',
        sbi_class: '',
        sbi_youth_league_branch: '',
        sbi_party_branch: '',
        sbi_teacher: '',
        sbi_class_teacher: '',
        sbi_instructor: '',
        sbi_organizer: '',
        sbi_dean: '',
        sbi_group: ''
      }
      this.$refs.table.clearSort()
      this.$refs.table.clearFilter()
      this.search()
    },
    handleClick(row) {
      this.selectSbiNumber = row.sbiNumber
      this.fetch()
      this.detailStudentDialogVisible = true
    },
    filterTag1(value, row) {
      return row.tag1 === value
    },
    formatter(row, column) {
      return row.message
    },
    fetch() {
      this.dialogData.tableData = []
      this.$get('achievement/sbi/fetchSbiByNumber', {
        sbiNumber: this.selectSbiNumber
      }).then((r) => {
        const data = r.data.data
        this.dialogData.sbiName = data.sbiName
        this.dialogData.sbiNumber = data.sbiNumber
        this.dialogData.sbiSex = data.sbiSex
        this.dialogData.sbiAcademy = data.sbiAcademy
        this.dialogData.sbiDepartment = data.sbiDepartment
        this.dialogData.sbiMajor = data.sbiMajor
        this.dialogData.tableData.push(
          {
            type: '姓名',
            info: this.judgeNull(data.sbiName)
          },
          {
            type: '学号',
            info: this.judgeNull(data.sbiNumber)
          },
          {
            type: '性别',
            info: this.judgeNull(data.sbiSex)
          },
          {
            type: '学院',
            info: this.judgeNull(data.sbiAcademy)
          },
          {
            type: '系',
            info: this.judgeNull(data.sbiDepartment)
          },
          {
            type: '专业',
            info: this.judgeNull(data.sbiMajor)
          },
          {
            type: '出生日期',
            info: this.judgeNull(data.sbiBirthdate)
          },
          {
            type: '民族',
            info: this.judgeNull(data.sbiNation)
          },
          {
            type: '前置学历',
            info: this.judgeNull(data.sbiFormerEducation)
          },
          {
            type: '入学方式',
            info: this.judgeNull(data.sbiEntranceWay)
          },
          {
            type: '入学时间',
            info: this.judgeNull(data.sbiEntranceYear) + '-' + this.judgeNull(data.sbiEntranceMonth)
          },
          {
            type: '预计毕业时间',
            info: this.judgeNull(data.sbiPredictGraduateYear) + '-' + this.judgeNull(data.sbiPredictGraduateMonth)
          },
          {
            type: '学制',
            info: this.judgeNull(data.sbiEducationSystem)
          },
          {
            type: '培养层次',
            info: this.judgeNull(data.sbiTrainingLevel)
          },
          {
            type: '学籍类型',
            info: this.judgeNull(data.sbiStatusType)
          },
          {
            type: '身份证件类型',
            info: this.judgeNull(data.sbiIDType)
          },
          {
            type: '身份证件号',
            info: this.judgeNull(data.sbiIDNumber)
          },
          {
            type: '生源地国家',
            info: this.judgeNull(data.sbiSourceOfSchoolEnrollmentCountry)
          },
          {
            type: '生源地省',
            info: this.judgeNull(data.sbiSourceOfSchoolEnrollmentProvince)
          },
          {
            type: '生源地市',
            info: this.judgeNull(data.sbiSourceOfSchoolEnrollmentCity)
          },
          {
            type: '政治面貌',
            info: this.judgeNull(data.sbiPolicyOutlook)
          },
          {
            type: '户口所在地',
            info: this.judgeNull(data.sbiRegisteredResidencePlace)
          },
          {
            type: '入学前户口性质',
            info: this.judgeNull(data.sbiFormerRegisteredResidenceProperty)
          },
          {
            type: '手机号',
            info: this.judgeNull(data.sbiCellNumber)
          },
          {
            type: '电子信箱',
            info: this.judgeNull(data.sbiEmail)
          },
          {
            type: 'QQ号',
            info: this.judgeNull(data.sbiQq)
          },
          {
            type: '微信号',
            info: this.judgeNull(data.sbiWechat)
          },
          {
            type: '校外（家庭）居住国家',
            info: this.judgeNull(data.sbiLivingCountry)
          },
          {
            type: '校外（家庭）居住省',
            info: this.judgeNull(data.sbiLivingProvince)
          },
          {
            type: '校外（家庭）居住市',
            info: this.judgeNull(data.sbiLivingCity)
          },
          {
            type: '校外（家庭）居住区',
            info: this.judgeNull(data.sbiLivingDistrict)
          },
          {
            type: '校外（家庭）居住详细地址',
            info: this.judgeNull(data.sbiLivingDetailedAddress)
          },
          {
            type: '家属姓名',
            info: this.judgeNull(data.sbiRelativeName)
          },
          {
            type: '家属联系方式',
            info: this.judgeNull(data.sbiRelativeContract)
          },
          {
            type: '班级',
            info: this.judgeNull(data.sbiClass)
          },
          {
            type: '团支部',
            info: this.judgeNull(data.sbiYouthLeagueBranch)
          },
          {
            type: '党支部',
            info: this.judgeNull(data.sbiPartyBranch)
          },
          {
            type: '导师',
            info: this.judgeNull(data.sbiTeacher)
          },
          {
            type: '导师工号',
            info: this.judgeNull(data.sbiTeacherNumber)
          },
          {
            type: '班主任',
            info: this.judgeNull(data.sbiClassTeacher)
          },
          {
            type: '班主任工号',
            info: this.judgeNull(data.sbiClassTeacherNumber)
          },
          {
            type: '辅导员',
            info: this.judgeNull(data.sbiInstructor)
          },
          {
            type: '辅导员工号',
            info: this.judgeNull(data.sbiInstructorNumber)
          },
          {
            type: '组织员',
            info: this.judgeNull(data.sbiOrganizer)
          },
          {
            type: '组织员工号',
            info: this.judgeNull(data.sbiOrganizerNumber)
          },
          {
            type: '教务员',
            info: this.judgeNull(data.sbiDean)
          },
          {
            type: '教务员工号',
            info: this.judgeNull(data.sbiDeanNumber)
          },
          {
            type: '住校',
            info: this.judgeNull(data.sbiLivingAtSchool)
          },
          {
            type: '宿舍校区',
            info: this.judgeNull(data.sbiDormitoryCampus)
          },
          {
            type: '宿舍楼栋',
            info: this.judgeNull(data.sbiDormitoryBuilding)
          },
          {
            type: '宿舍房间号',
            info: this.judgeNull(data.sbiDormitoryRoom)
          }
        )
        this.dialogData.changeStudentBaseInfoForm.sbiIndex = data.sbiIndex
        this.dialogData.changeStudentBaseInfoForm.sbiNumber = data.sbiNumber
        this.dialogData.changeStudentBaseInfoForm.sbiName = data.sbiName
        this.dialogData.changeStudentBaseInfoForm.sbiSex = data.sbiSex
        this.dialogData.changeStudentBaseInfoForm.sbiBirthdate = data.sbiBirthdate
        this.dialogData.changeStudentBaseInfoForm.sbiNation = data.sbiNation
        this.dialogData.changeStudentBaseInfoForm.sbiAcademy = data.sbiAcademy
        this.dialogData.changeStudentBaseInfoForm.sbiDepartment = data.sbiDepartment
        this.dialogData.changeStudentBaseInfoForm.sbiMajor = data.sbiMajor
        this.dialogData.changeStudentBaseInfoForm.sbiFormerEducation = data.sbiFormerEducation
        this.dialogData.changeStudentBaseInfoForm.sbiEntranceWay = data.sbiEntranceWay
        this.dialogData.changeStudentBaseInfoForm.sbiEntranceYear = data.sbiEntranceYear
        this.dialogData.changeStudentBaseInfoForm.sbiEntranceMonth = data.sbiEntranceMonth
        this.dialogData.changeStudentBaseInfoForm.sbiEducationSystem = data.sbiEducationSystem
        this.dialogData.changeStudentBaseInfoForm.sbiPredictGraduateYear = data.sbiPredictGraduateYear
        this.dialogData.changeStudentBaseInfoForm.sbiPredictGraduateMonth = data.sbiPredictGraduateMonth
        this.dialogData.changeStudentBaseInfoForm.sbiTrainingLevel = data.sbiTrainingLevel
        this.dialogData.changeStudentBaseInfoForm.sbiStatusType = data.sbiStatusType
        this.dialogData.changeStudentBaseInfoForm.sbiIDType = data.sbiIDType
        this.dialogData.changeStudentBaseInfoForm.sbiIDNumber = data.sbiIDNumber
        this.dialogData.changeStudentBaseInfoForm.sbiSourceOfSchoolEnrollmentCountry = data.sbiSourceOfSchoolEnrollmentCountry
        this.dialogData.changeStudentBaseInfoForm.sbiSourceOfSchoolEnrollmentProvince = data.sbiSourceOfSchoolEnrollmentProvince
        this.dialogData.changeStudentBaseInfoForm.sbiSourceOfSchoolEnrollmentCity = data.sbiSourceOfSchoolEnrollmentCity
        this.dialogData.changeStudentBaseInfoForm.sbiPolicyOutlook = data.sbiPolicyOutlook
        this.dialogData.changeStudentBaseInfoForm.sbiRegisteredResidencePlace = data.sbiRegisteredResidencePlace
        this.dialogData.changeStudentBaseInfoForm.sbiFormerRegisteredResidenceProperty = data.sbiFormerRegisteredResidenceProperty
        this.dialogData.changeStudentBaseInfoForm.sbiCellNumber = data.sbiCellNumber
        this.dialogData.changeStudentBaseInfoForm.sbiEmail = data.sbiEmail
        this.dialogData.changeStudentBaseInfoForm.sbiQq = data.sbiQq
        this.dialogData.changeStudentBaseInfoForm.sbiWechat = data.sbiWechat
        this.dialogData.changeStudentBaseInfoForm.sbiLivingCountry = data.sbiLivingCountry
        this.dialogData.changeStudentBaseInfoForm.sbiLivingProvince = data.sbiLivingProvince
        this.dialogData.changeStudentBaseInfoForm.sbiLivingCity = data.sbiLivingCity
        this.dialogData.changeStudentBaseInfoForm.sbiLivingDistrict = data.sbiLivingDistrict
        this.dialogData.changeStudentBaseInfoForm.sbiLivingDetailedAddress = data.sbiLivingDetailedAddress
        this.dialogData.changeStudentBaseInfoForm.sbiRelativeName = data.sbiRelativeName
        this.dialogData.changeStudentBaseInfoForm.sbiRelativeContract = data.sbiRelativeContract
        this.dialogData.changeStudentBaseInfoForm.sbiClass = data.sbiClass
        this.dialogData.changeStudentBaseInfoForm.sbiYouthLeagueBranch = data.sbiYouthLeagueBranch
        this.dialogData.changeStudentBaseInfoForm.sbiPartyBranch = data.sbiPartyBranch
        this.dialogData.changeStudentBaseInfoForm.sbiTeacher = data.sbiTeacher
        this.dialogData.changeStudentBaseInfoForm.sbiTeacherNumber = data.sbiTeacherNumber
        this.dialogData.changeStudentBaseInfoForm.sbiClassTeacher = data.sbiClassTeacher
        this.dialogData.changeStudentBaseInfoForm.sbiClassTeacherNumber = data.sbiClassTeacherNumber
        this.dialogData.changeStudentBaseInfoForm.sbiInstructor = data.sbiInstructor
        this.dialogData.changeStudentBaseInfoForm.sbiInstructorNumber = data.sbiInstructorNumber
        this.dialogData.changeStudentBaseInfoForm.sbiOrganizer = data.sbiOrganizer
        this.dialogData.changeStudentBaseInfoForm.sbiOrganizerNumber = data.sbiOrganizerNumber
        this.dialogData.changeStudentBaseInfoForm.sbiDean = data.sbiDean
        this.dialogData.changeStudentBaseInfoForm.sbiDeanNumber = data.sbiDeanNumber
        this.dialogData.changeStudentBaseInfoForm.sbiLivingAtSchool = data.sbiLivingAtSchool
        this.dialogData.changeStudentBaseInfoForm.sbiDormitoryCampus = data.sbiDormitoryCampus
        this.dialogData.changeStudentBaseInfoForm.sbiDormitoryBuilding = data.sbiDormitoryBuilding
        this.dialogData.changeStudentBaseInfoForm.sbiDormitoryRoom = data.sbiDormitoryRoom
        this.dialogData.loading = false
        // console.log(data);
      })
    },
    returnReview() {
      this.detailStudentDialogVisible = false
    },
    judgeNull(obj) {
      if (obj === null) {
        return 'NULL'
      } else {
        return obj
      }
    },
    changeStudentBaseInfoSubmit() {
      axios({
        method: 'post',
        url: '/api/achievement/sbi/updateSbi',
        headers: { Authorization: 'bearer ' + getToken() },
        data: { ...this.dialogData.changeStudentBaseInfoForm }
      }).then((r) => {
        // const data = r.data
        this.fetch()
        this.dialogData.changeStudentBaseInfoFormVisible = false
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import "SelectType.scss";

.el-input__inner {
  style: "width:200px"
}
</style>
